import Dialog from '../../miniprogram_npm/@vant/weapp/dialog/dialog';


Page({
    data: {
        popupShow: true,
        members: [
            {
                url: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.17qq.com%2Fimg_qqtouxiang%2F90531813.jpeg&refer=http%3A%2F%2Fwww.17qq.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1616903046&t=71fcb84d876f46965d0cfdc05b0b9522",
                name: "tom",
                money: 100
            },
            {
                url: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.17qq.com%2Fimg_qqtouxiang%2F90531813.jpeg&refer=http%3A%2F%2Fwww.17qq.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1616903046&t=71fcb84d876f46965d0cfdc05b0b9522",
                name: "tony",
                money: -100
            },
            {
                url: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.17qq.com%2Fimg_qqtouxiang%2F90531813.jpeg&refer=http%3A%2F%2Fwww.17qq.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1616903046&t=71fcb84d876f46965d0cfdc05b0b9522",
                name: "timi",
                money: 200
            },
            {
                url: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.17qq.com%2Fimg_qqtouxiang%2F90531813.jpeg&refer=http%3A%2F%2Fwww.17qq.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1616903046&t=71fcb84d876f46965d0cfdc05b0b9522",
                name: "timi",
                money: 200
            },
            {
                url: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.17qq.com%2Fimg_qqtouxiang%2F90531813.jpeg&refer=http%3A%2F%2Fwww.17qq.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1616903046&t=71fcb84d876f46965d0cfdc05b0b9522",
                name: "茶水",
                money: 200
            },
            {
                url: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.17qq.com%2Fimg_qqtouxiang%2F90531813.jpeg&refer=http%3A%2F%2Fwww.17qq.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1616903046&t=71fcb84d876f46965d0cfdc05b0b9522",
                name: "添加好友",
                money: 200
            },

        ],
        bill_info: [
            {
                target: "年少不知轻狂",
                money: 5000
            },
            {
                target: "青山不怕火烧",
                money: 3000
            },
            {
                target: "茶水",
                money: 200
            },
        ],
        info_list:[
            {
                data:'Transcend进入房间',
                type:0
            },
            {
                data:'Transcend退出房间',
                type:0
            },
            {
                sender:"Transcend",
                receiver:"大钊",
                money:5000,
                type:1,
            },
            {
                sender:"Transcend",
                receiver:"大钊",
                money:5000,
                type:1
            },
        ]
    },
    // 关闭弹窗
    onClose() {
      this.setData({
        popupShow: false
      })
    },
    // 转发给好友
    onShareAppMessage: function () {
      return {
        title: '打牌记账--- 7325房间',
        path: '/pages/room/room'
      }
    },
    chargeTap() {
        wx.navigateTo({
            url: '/pages/charge/charge'
        })
    },
    transferTap() {
        wx.navigateTo({
            url: "/pages/room/transfer/transfer",
        })
    },
    avatarTap() {
        Dialog.confirm({
            confirmButtonText: "退出房间",
            showCancelButton: false,
            showConfirmButton: false,
            closeOnClickOverlay: true
        }).then(() => {
            // on close
        }).catch(() => {
            // on cancel
        });
    },
    test() {
        wx.sendSocketMessage({
            data:"first message"
        })
    },
    onLoad(){
        wx.connectSocket({
            url:'ws://123.207.136.134:9010/ajaxchattest'
        });
        wx.onSocketMessage(function(res){
            console.log(`服务端发来信息：${res.data}`);
        })
    },
    
})